//package com.ld.security.common.activiti;
//
//import org.activiti.engine.ProcessEngineConfiguration;
//import org.activiti.spring.ProcessEngineFactoryBean;
//import org.activiti.spring.SpringAsyncExecutor;
//import org.activiti.spring.SpringProcessEngineConfiguration;
//import org.activiti.spring.boot.AbstractProcessEngineAutoConfiguration;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.transaction.PlatformTransactionManager;
//
//import javax.sql.DataSource;
//import java.io.IOException;
//
//@Configuration
//public class ActivitiConfig2 extends AbstractProcessEngineAutoConfiguration {
//
//    @Bean
//    @Override
//    public SpringProcessEngineConfiguration baseSpringProcessEngineConfiguration(DataSource dataSource, PlatformTransactionManager platformTransactionManager, SpringAsyncExecutor springAsyncExecutor) throws IOException {
//        SpringProcessEngineConfiguration pec =  super.baseSpringProcessEngineConfiguration(dataSource, platformTransactionManager, springAsyncExecutor);
//        pec.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
//
//        return pec;
//    }
//
//
//
//    @Override
//    public ProcessEngineFactoryBean processEngine(SpringProcessEngineConfiguration configuration) throws Exception {
//        return super.processEngine(configuration);
//    }
//
//    //    @Autowired
////    private DataSource dataSource;
////
////    @Autowired
////    private ResourcePatternResolver resourceLoader;
////
////    /**
////     * 初始化配置，将创建28张表
////     * @return
////     */
////    @Bean
////    public StandaloneProcessEngineConfiguration processEngineConfiguration() {
////        StandaloneProcessEngineConfiguration configuration = new StandaloneProcessEngineConfiguration();
////        configuration.setDataSource(dataSource);
////        configuration.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
////        configuration.setAsyncExecutorActivate(false);
////        return configuration;
////    }
////
////    @Bean
////    public ProcessEngine processEngine() {
////        return processEngineConfiguration().buildProcessEngine();
////    }
////
////    @Bean
////    public RepositoryService repositoryService() {
////        return processEngine().getRepositoryService();
////    }
////
////    @Bean
////    public RuntimeService runtimeService() {
////        return processEngine().getRuntimeService();
////    }
////
////    @Bean
////    public TaskService taskService() {
////        return processEngine().getTaskService();
////    }
////
////
////    /**
////     * 部署流程
////     * @throws IOException
////     */
////    @PostConstruct
////    public void initProcess() throws IOException {
////        DeploymentBuilder deploymentBuilder= repositoryService().createDeployment();
////        Resource resource = resourceLoader.getResource("classpath:/processes/UserAudit.bpmn");
////        deploymentBuilder .enableDuplicateFiltering().addInputStream(resource.getFilename(), resource.getInputStream()).name("UserAudit").deploy();
////        deploymentBuilder .enableDuplicateFiltering().addClasspathResource("UserAudit.bpmn").name("UserAudit").deploy();
////    }
//}